package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Log;
import com.hzdl.car.mapper.LogMapper;
import com.hzdl.car.service.LogService;
import com.hzdl.car.vo.LogVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
@Transactional
@Service
public class LogServiceImpl implements LogService {
    @Resource
    private LogMapper logMapper;
    @Override
    public PageInfo<Log> findLog(LogVo logVo) {
        PageHelper.startPage(logVo.getPage(),logVo.getLimit());
        List<Log> list=logMapper.findLog(logVo);
        PageInfo<Log> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int addLog(LogVo logVo) {
        return logMapper.addLog(logVo);
    }

    @Override
    public int dekLog(LogVo logVo) {
        return logMapper.dekLog(logVo);
    }

    @Override
    public int logDelChk(Integer[] ids) {
        int row=0;
        for (Integer i:ids){
            LogVo logVo=new LogVo();
            logVo.setId(i);
            row+=logMapper.dekLog(logVo);
        }
        return row;
    }
}
